function impedance_frequency_exp_40V()
close all;


%% Paper
Vin=[40];
Iout=[1];
figure;
cc=hsv(4);
marker={'x-'; 'o-';'^-';'*-'};
for i=1:length(Vin)
    file=sprintf('./data/impedance_vs_frequency/SC_impedance_frequency_hard_%iV_%iA_440k_200k.dat',Vin(i),Iout(i))
    M = csvread(file,1,0);
    impedance=(M(:,2)/8-M(:,4))./M(:,5);
    frequency=[length(M(:,2)):-1:1]*20+180;  % min frequency is 200 kHz
    plot(frequency,impedance,marker{1},'color',cc(1,:),'LineWidth',0.75);
    hold all;
    legendInfo{i} = sprintf('V_{in}=%i V',Vin(i));
end
    file=sprintf('./data/impedance_vs_frequency/Manual_impedance_frequency_hard_%iV_%iA_440k_200k.dat',Vin(i),Iout(i))
    M = csvread(file,1,0);
    impedance=(M(:,2)/8-M(:,4))./M(:,5);
    frequency=M(:,1);  % min frequency is 200 kHz
    plot(frequency,impedance,marker{1},'color',cc(1,:),'LineWidth',0.75);
% for i=1:length(Vin)
%     file=sprintf('./data/impedance_vs_frequency/SC_impedance_frequency_soft_%iV_%iA.dat',Vin(i),Iout(i))
%     M = csvread(file,1,0);
%     impedance=(M(:,2)/8-M(:,4))./M(:,5);
%     frequency=[length(M(:,2)):-1:1]*10+90;  % min frequency is 50 kHz
%     plot(frequency,impedance,marker{1},'color',cc(1,:),'LineWidth',0.75);
%     hold all;
%     legendInfo{i} = sprintf('V_{in}=%i V',Vin(i));
% end
for i=1:length(Vin)
    file=sprintf('./data/impedance_vs_frequency/SC_impedance_frequency_soft1_%iV_%iA_no.dat',Vin(i),Iout(i))
    M = csvread(file,1,0);
    impedance=(M(:,2)/8-M(:,4))./M(:,5);
    frequency=[length(M(:,2)):-1:1]*10+40;  % min frequency is 50 kHz
    plot(frequency,impedance,marker{2},'color',cc(2,:),'LineWidth',0.75);
    hold all;
    legendInfo{i} = sprintf('V_{in}=%i V',Vin(i));

end
%%  Split-phase
impedance=[0.118043, ...
    (40.054/8-4.88)/1.1359,...
    (40.054/8-4.8874)/1.1361,...
    (40.061/8-4.8903)/1.1363,...
    (40.061/8-4.8903)/1.1364];
frequency=[50, 75, 100, 150, 250];
loglog(frequency,impedance,marker{3},'color',cc(3,:))
%%
xlabel('Frequency (kHz)');
ylabel('Output impedance(\Omega)');
legend(legendInfo,'Location','NorthEast');
grid on;
% ylim([65 100]);
% xlim([0 410]);

set(gcf, 'Position', [200 200 450 300])
set(gcf,'PaperPositionMode','auto')
% print('-depsc2', '../Paper/images/efficiency_unregulated_exp');
% matlab2tikz( '../Paper/images/efficiency_unregulated_exp.tikz',  'height', '\figureheight', 'width', '\figurewidth','showInfo', false);

end